#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

bool check(const vector<int>& nums, int L, double mid) {
    int n=nums.size();
    vector<double> pre(n+1,0);
    for(int i=0;i<n;i++){
        pre[i+1]=pre[i]+(nums[i]-mid);
    }
    double mn=pre[0];
    for(int j=L;j<=n;j++){
        if(pre[j]-mn>=0)return true;
        mn=min(mn,pre[j-L+1]);
    }
    return false;
}

void solve() {
    int n, L;
    cin >> n >> L;
    vector<int> nums(n);
    for (int i = 0; i < n; ++i) {
        cin >> nums[i];
    }
    double left = -1e4, right = 1e4;
    for (int i = 0; i < 100; ++i) {
        double mid = (left + right) / 2;
        if (check(nums, L, mid)) {
            left = mid;
        } else {
            right = mid;
        }
    }
    cout << fixed << setprecision(5) << left << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}